// pages/mycurriculum/mycurriculum.js
var app = getApp(), api = app.api;

Page({

  /**
   * 页面的初始数据
   */
  data: {
    page:1,
    course_date_list:[],
    list:[],
    open:0,
    course_date:0
  },
  list:function(res){
    console.log(res)
    console.log(res)
    var id=res.currentTarget.dataset.goods_id;
    wx.navigateTo({
      url: '/pages/my-class-teacher-list/my-class-teacher-list?goods_id=' + id,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    that.class_list()
  },
  class_list:function(){
    var that = this
    getApp().request({
            url: getApp().api.schoolclass.class_list,
            method: "GET",
            data: {
                page:that.data.page,
                course_date:that.data.course_date
            },
            success: function (res) {
               console.log(res.data.list, '数据')
                that.setData({
                  course_date_list:res.data.course_date_list
              })
              for(var i =0;i<res.data.list.length;i++){
                that.data.list.push(res.data.list[i])
                that.setData({
                  list : that.data.list
              })
             }
            }
          });
  },
// 点击选中日期
open_time:function(e){
  var that = this
  console.log('e:',e)
  that.setData({
    open:e.currentTarget.dataset.index,
    course_date:e.currentTarget.dataset.course_date,
    page:0,
    list:[]
  })
  that.class_list()
},
//点击签到签退
get_myclass:function(e){
  console.log('e',e)
  wx.navigateTo({ url: '/schoolclass/collegeSign/index?course_time_id='+e.currentTarget.dataset.course_time_id+'&sign_type='+e.currentTarget.dataset.sign_type, })
},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that = this
    that.setData({
      page:that.data.page + 1
    })
    that.class_list()
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})